﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
public class ScoreManager : MonoBehaviour {

    public static ScoreManager instance;
    public Text[] scoreText;
    public List<int> scoreList;
    void Awake()
    {
        instance = this;
        scoreList = new List<int>();
    }

    public void SetScore(int score)
    {
        scoreList.Add(score);
    }

    public void SortList()
    {
        scoreList.Sort();
        scoreList.Reverse();
    }

    public void PrintScore()
    {
        SortList();

        int index = 0;
        foreach (int item in ScoreManager.instance.scoreList)
        {
            if (item != null)
            {
                if (index > 2)
                {
                    break;
                }
                scoreText[index].text = item + "分";
                index++;
              
            }



        }
    }
}
